﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
#endregion

namespace TheSpirit
{
    class InformationWindow
    {
        Texture2D Fire1;
        Texture2D Water1;
        Texture2D Forest1;
        Texture2D currentTexture;

        Rectangle position;

        bool isDraw;

        public InformationWindow()
        {
            isDraw = false;
        }

        public void LoadContent(ContentManager content)
        {
            Fire1 = content.Load<Texture2D>("Fields/Info/Fire1");
            Water1 = content.Load<Texture2D>("Fields/Info/Water1");
            Forest1 = content.Load<Texture2D>("Fields/Info/Forest1");

            int x = Constants.WIDTH * 950 / 1280;
            int y = Constants.HEIGHT * 20 / 720;
            int w = Fire1.Width;
            int h = Fire1.Height;

            position = new Rectangle(x, y, w, h);
        }

        public void Update(GameTime gameTime, Character character)
        {
            isDraw = false;

            switch (character.CharacterAttr.attributeType)
            {
                case Attribute.AttributeType.Fire:
                    switch (character.Level)
                    {
                        case 1:
                            currentTexture = Fire1;
                            break;
                        case 2:
                            break;
                        case 3:
                            break;
                    }
                    break;
                case Attribute.AttributeType.Water:
                    switch (character.Level)
                    {
                        case 1:
                            currentTexture = Water1;
                            break;
                        case 2:
                            break;
                        case 3:
                            break;
                    }
                    break;
                case Attribute.AttributeType.Forest:
                    switch (character.Level)
                    {
                        case 1:
                            currentTexture = Forest1;
                            break;
                        case 2:
                            break;
                        case 3:
                            break;
                    }
                    break;
            }

            if (character.IsSelected)
                isDraw = true;
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            if(isDraw)
                spriteBatch.Draw(currentTexture, position, Color.White);
        }
    }
}
